/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.web.mapper;

import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.web.entity.YJRoomUser;
import com.jeeplus.modules.web.entity.YjScoreRecord;
import com.jeeplus.modules.web.entity.wx.YsUser;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 房价玩家MAPPER接口
 *
 * @author rongjie
 * @version 2017-08-06
 */
@MyBatisMapper
public interface YJRoomUserMapper extends BaseMapper<YJRoomUser> {
    
    int addRoomUser(YJRoomUser yjRoomUser);
    
    List<YJRoomUser> findIsOut(@Param("isOut") String isOut, @Param("roomUser") String roomUser);
    
    Integer updateIsOutByUser(@Param("isOut") String isOut, @Param("roomUser") String roomUser, @Param("roomFlag") String roomFlag);
    
    List<String> findRooNumByIsOut(@Param("isOut") String isOut);
    
    List<YJRoomUser> findByRoomFlagAndIsOut(@Param("isOut") String isOut, @Param("roomFlag") String roomFlag);
    
    List<YsUser> findUserInfoByRoomFlag(@Param("roomFlag") String roomFlag);
    
    List<YJRoomUser> findFalgByNumber(@Param("roomNum") String roomNum);
    
    List<YJRoomUser> findUserByFlagAndNum(@Param("roomNum") String roomNum, @Param("roomFlag") String roomFlag);
    
    List<YJRoomUser> findUserByFlagAndNumAndOpenId(@Param("roomNum") String roomNum, @Param("roomFlag") String roomFlag, @Param("openId") String openId);
    
    /**
     * 根据用户和房间码确定用户是否存在，存在返回房间号
     *
     * @param roomUser
     * @param roomFlag
     * @return
     */
    String findIsExisRoom(@Param("roomUser") String roomUser, @Param("roomFlag") String roomFlag);
    
    void updateEndGamesCountByRoomFlag(@Param("roomFlag") String roomFlag, @Param("gamesCount") String gamesCount);
    
    List<YjScoreRecord> findScoringDetails(@Param("roomFlags") String roomFlags);
    
    List<String> findRoomFlagByRoomUser(@Param("openId") String openId, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
    
    Integer findRoomFlagCountByRoomUser(@Param("openId") String openId);

    List<YJRoomUser> findListUserName(YJRoomUser yjRoomUser);
}
